<%@page import="entities.KeywordRanking"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="java.util.List"%>
<%@page import="com.google.gson.Gson"%>
<%@page import="java.util.Map"%>
<%@page import="helpers.StringHelper"%>
<%@page import="helpers.DateHelper"%>
<%@page import="helpers.NumberHelper"%>
<%@page import="entities.IpAddress"%>
<%@page import="entities.GoogleAnalytic"%>
<%@page import="entities.GoogleAdsense"%>
<%@page import="entities.Domain"%>
<%
request.setCharacterEncoding("UTF-8");
Domain domain = (Domain) request.getAttribute("domain");
GoogleAdsense googleAdsense = (GoogleAdsense) request.getAttribute("googleAdsense");
GoogleAnalytic googleAnalytic = (GoogleAnalytic) request.getAttribute("googleAnalytic");
IpAddress ipAddress = (IpAddress) request.getAttribute("ipAddress");
KeywordRanking keyword = (KeywordRanking) request.getAttribute("keyword");

//Set content for Seo
String title = domain.getDomain() + " Website - " + domain.getTitle();
String description = domain.getDomain() + " has Alexa Rank " + NumberHelper.numberFormat(domain.getAlexaRank()) + " and Google Page Rank is " + domain.getGooglePageRank()
					+ ". Size page is " + domain.getPageSize() + ". Ip Address for " + domain.getDomain() + " is " + domain.getIpAddress() 
					+ ". Domain " + domain.getDomain() + " has age is " + domain.getAge();

String keywords = domain.getDomain() + ", soa record, dns record, site info, ip location, whois ip, ip address";
String url = UrlHelper.getServerUrl(request) + "/domain/" + domain.getDomain();
String ogimage = "http://immediatenet.com/t/t_a?Size=1024x768&URL=" + domain.getDomain();
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="/layouts/header.jsp">
	<jsp:param name="title" value="<%=title %>" />
    <jsp:param name="description" value="<%=description %>" />
    <jsp:param name="keywords" value="<%=keywords %>" />
    <jsp:param name="ogtitle" value="<%=title %>" />
    <jsp:param name="ogurl" value="<%=url %>" />
    <jsp:param name="ogimage" value="<%=ogimage %>" />
    <jsp:param name="ogdescription" value="<%=description%>" />
</jsp:include>

	<script type="text/javascript" src="/js/info.js"></script>
	<script type='text/javascript' src='https://www.google.com/jsapi'></script>
	
	<div id="content">
		<jsp:include page="/elements/search_bar.jsp" />
		
		<div class="row">
			<!-- Left Content BEGIN -->
			<div class="span9">
				<section class="site-name">
					<div class="box1">
						<div class="row-fluid">
							<div class="span2">
								<img src="http://chart.apis.google.com/chart?chs=80x80&cht=qr&chld=|0&chl=http://<%=domain.getDomain() %>" />
							</div>
							<div class="span10">
								<h1 class="title"><a href="/o/<%=domain.getDomain() %>"><%=domain.getDomain() %></a></h1>
								<p>
									<% if (domain.getDescription().isEmpty()) { %>
	                    				<%=domain.getDomain() %> has Alexa Rank <%=NumberHelper.numberFormat(domain.getAlexaRank()) %> and Google Page Rank is <%=domain.getGooglePageRank() %>
	                    			<% } else { %>
											<%=StringHelper.cutString(domain.getDescription(), 33)  %>...
	                    			<% } %>
								</p>
								<div class="adv">
									<script type="text/javascript"><!--
									google_ad_client = "ca-pub-4975603569119809";
									/* showdomain 468x60 */
									google_ad_slot = "3934035319";
									google_ad_width = 468;
									google_ad_height = 60;
									//-->
									</script>
									<script type="text/javascript"
									src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
									</script>
								</div>
								<%
                    			int rating = 3;
                    			if (domain.getGooglePageRank() > 6) { 
                    				rating = 5;
                    			} else if (domain.getGooglePageRank() > 2) {
                    				rating = 4;
                    			};
                    			%>
                    			​<div class="hreview hidden">
                    				Rating: <span class="rating"><%=rating %></span>
                    			</div>
							</div>
						</div>
						<div class="site-update">
							 <% if (!domain.isProcessing()) { %>
                        	This data was last updated from <%=DateHelper.getStringFromDate(domain.getUpdated(), "dd-MM-yyyy") %>&nbsp;
                        		<% if (!DateHelper.checkGreaterNow(domain.getUpdated(), 1440)) { %> 
	                        	<a href="#" class="update-data">(update)</a>.
	                        	<% } %>
                        	<% } else { %>
                        	Processing update domain...
                        	<% } %>
						</div>
					</div>
				</section>
				
				<div class="adv">
					<script type="text/javascript"><!--
					google_ad_client = "ca-pub-4975603569119809";
					/* showdomain 468x60 */
					google_ad_slot = "3934035319";
					google_ad_width = 468;
					google_ad_height = 60;
					//-->
					</script>
					<script type="text/javascript"
					src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
					</script>
				</div>
				
				<!-- Site Info BEGIN -->
				<section class="siteInfo">
					<div class="block">
						<h3 class="title">Site Info</h3>
						<div class="content-block">
							<div class="adv left">
								<script type="text/javascript"><!--
								google_ad_client = "ca-pub-4975603569119809";
								/* showdomain 468x15 */
								google_ad_slot = "8143908917";
								google_ad_width = 468;
								google_ad_height = 15;
								//-->
								</script>
								<script type="text/javascript"
								src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
								</script>
							</div>
							<p><%=domain.getDomain() %> has Alexa Rank <%=NumberHelper.numberFormat(domain.getAlexaRank()) %> and Google Page Rank is <%=domain.getGooglePageRank() %></p>
							<div class="row-fluid f-info">
								<div class="span7">
									<h4>Title</h4>
									<p><%=domain.getTitle() %></p>
								</div>
								<div class="span4 offset1">
									<h4>Page Size</h4>
									<p><%=domain.getPageSize() %></p>
								</div>
							</div>
							<div class="row-fluid f-info">
								<div class="span7">
									<h4 class="title">Meta Keywords</h4>
									<p><%=domain.getKeywords() %></p>
								</div>
								<div class="span4 offset1">
									<h4>Image</h4>
									<%
                                 	Map<String, String> images = new Gson().fromJson(domain.getImages(), Map.class);
                                 	if (images.size() > 0) {
                                 	%>
                                     <ul>
                                     	<li>
                                     		<%
                                     			int count = 0;
                                     			for (Map.Entry<String, String> entry : images.entrySet()) { 
                                     		%>
                                     		    <%=count > 0? ", ": "" %><%=entry.getValue() %>&nbsp;<%=entry.getKey() %>
                                     		<% 
                                     				count ++;
                                     			} 
                                     		%>
                                     	</li>
                                     </ul>
                                     <% } %>
									
									<h4>Heading</h4>
									<%
                                   	Map<String, String> heading = new Gson().fromJson(domain.getHeading(), Map.class);
                                   	if (images.size() > 0) {
                                   	%>
                                    <ul>
                                    	<li>
                                    		<%
                                    			int count = 0;
                                    			for (Map.Entry<String, String> entry : heading.entrySet()) { 
                                    		%>
                                    		    <%=count > 0 ? ", ": "" %><%=entry.getKey() %>:&nbsp;<%=entry.getValue() %>
                                    		<% 
                                    				count ++;
                                    			} 
                                    		%>
                                    	</li>
                                    </ul>
                                    <% } %>
								</div>
							</div>
							
							<div class="row-fluid f-info">
								<div class="span12">
									<h4>Description</h4>
									<p><%=domain.getDescription() %></p>
								</div>
							</div>
						</div>
					</div>
				</section>
				<div class="homeshadowsep"></div>
				<!-- Site Info END -->
				
				<!-- DNS Analytic BEGIN -->
                <% if (!domain.getSoaRecord().isEmpty() || !domain.getDnsRecords().isEmpty()) { %>
				<section class="dnsRecord">
					<div class="block">
						<h3 class="title">DNS Record Analysis</h3>
						<div class="adv-title">
							<script type="text/javascript"><!--
							google_ad_client = "ca-pub-4975603569119809";
							/* showdomain 468x15 */
							google_ad_slot = "8143908917";
							google_ad_width = 468;
							google_ad_height = 15;
							//-->
							</script>
							<script type="text/javascript"
							src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
							</script>
						</div>
						
						<div class="content-block">
							<div class="tabbable"> <!-- Only required for left/right tabs -->
							  	<ul class="nav nav-tabs">
							      	<li class="active"><a href="#tab-soa-record" data-toggle="tab">Soa Record</a></li>
							      	<li><a href="#tab-dns-record" data-toggle="tab">Dns Record</a></li>
							  	</ul>
							  	<div class="tab-content">
							    	<div class="tab-pane active" id="tab-soa-record">
							        	<p>The Domain Name System (DNS) is a hierarchical distributed naming system for computers, services, or any resource connected to the Internet or a private network. It associates various information with domain names assigned to each of the participating entities. A Domain Name Service resolves queries for these names into IP addresses for the purpose of locating computer services and devices worldwide. By providing a worldwide, distributed keyword-based redirection service, the Domain Name System is an essential component of the functionality of the Internet.</p>
							        	<div class="soa-record">
											<%=domain.getSoaRecord() %>
										</div>
							    	</div>
							    	<div class="tab-pane" id="tab-dns-record">
							        	<%=domain.getDnsRecords() %>
							    	</div>
							  	</div>
							</div>
						</div>
					</div>
				</section>
				<div class="homeshadowsep"></div>
				<% } %>
				<!-- DNS Analytic END -->
				
				<!-- Traffic Analytic BEGIN -->
				<section class="siteInfo">
					<div class="block">
						<h3 class="title">Traffic Analysis</h3>
						<div class="content-block">
								
				    		<div class="row-fluid f-info">
								<div class="span12">
									<h4>Magestic Backlinks</h4>
									<img src="http://www.majesticseo.com/charts/backlinks-discovery-chart/<%=domain.getDomain() %>?w=677&h=155&IndexDataSource=F">
								</div>
							</div>
				        	<div class="row-fluid f-info">
								<div class="span5">
									<h4>Daily Ranks</h4>
									<img src="http://traffic.alexa.com/graph?c=1&u=<%=domain.getDomain() %>&r=6m&y=t&z=3&h=200&w=280&b=FFFFFF">
								</div>
								<div class="span5 offset2">
									<h4>Rank Trend</h4>
									<img src="http://traffic.alexa.com/graph?&w=295&h=200&o=f&c=1&y=t&b=ffffff&r=4y&u=<%=domain.getDomain() %>" />
								</div>
							</div>
							<div class="row-fluid f-info">
								<div class="span5">
									<h4>Visitor Trend</h4>
									<img src="http://grapher.compete.com/<%=domain.getDomain() %>_uv_310.png" />
								</div>
								<div class="span5 offset2">
									<h4>Bounce Trend</h4>
									<img src="http://traffic.alexa.com/graph?&w=295&h=200&o=f&c=1&y=b&b=ffffff&r=4y&u=<%=domain.getDomain() %>" />
								</div>
							</div>
						</div>
					</div>
				</section>
				<div class="homeshadowsep"></div>
				<!-- Traffic Analytic END -->
				
				<!-- Technical Analytic -->
				<section class="siteInfo">
					<div class="block">
						<h3 class="title">Site Technical Analysis</h3>
						<div class="content-block">
							<div class="tabbable"> <!-- Only required for left/right tabs -->
							  	<ul class="nav nav-tabs">
							      	<li class="active"><a href="#tab-site-technical" data-toggle="tab">Site Technical</a></li>
							      	<li><a href="#tab-header" data-toggle="tab">Http Header</a></li>
							      	<li><a href="#tab-whois" data-toggle="tab">Whois</a></li>
							  	</ul>
							  	<div class="tab-content">
							    	<div class="tab-pane active" id="tab-site-technical">
							        	<div class="row-fluid f-info">
											<div class="span3">
												<h4>Web server</h4>
												<ul>
													<li><%=domain.getWebServer() %></li>
												</ul>
											</div>
											<div class="span3 offset1">
												<h4>Javascript Library</h4>
												<%
				                               	List<String> libJs = new Gson().fromJson(domain.getJavascriptLibrary(), List.class);
				                               	%>
			                                    <ul>
			                                    	<% for (int i = 0; i < libJs.size(); i++) { %>
			                                        <li><%=libJs.get(i) %></li>
			                                        <% } %>
			                                    </ul>
											</div>
											<div class="span3 offset1">
												<h4>Ip Address</h4>
												<ul>
													<li><a href="/checkip?q=<%=domain.getIpAddress() %>"><%=domain.getIpAddress() %></a></li>
												</ul>
											</div>
										</div>
										
										<div class="row-fluid f-info">
											<div class="span3">
												<h4>Language used</h4>
												<ul>
													<li>HTML</li>
			                                        <li>CSS</li>
			                                        <li>JAVASCRIPT</li>
												</ul>
											</div>
											<div class="span3 offset1">
												<h4>Domain Age</h4>
			                                    <ul>
			                                    	<li><%=domain.getAge() %></li>
			                                    </ul>
											</div>
											<div class="span3 offset1">
											</div>
										</div>
										
										<div class="row-fluid f-info">
											<div class="span12">
												<h4>Site Same Ip <%=domain.getIpAddress() %></h4>
												<a href="/reverseip?q=<%=domain.getIpAddress() %>" class="view-more">(View more)</a>
												<ul>
													<li>
														<%
														if (ipAddress != null) {
		                                        			List<String> ipAddressDomains = ipAddress.getDomains();
		                                        			for (int i = 0; i < ipAddressDomains.size(); i++) { 
		                                        				if (i >= 20) break;
	                                        			%>
	                                        			<%=i > 0 ? ", " : "" %><a href="/domain/<%=ipAddressDomains.get(i) %>"><%=ipAddressDomains.get(i) %></a>
	                                        			<% 	}
		                                        		}%>
													</li>
												</ul>
											</div>
										</div>
							    	</div>
							    	<div class="tab-pane" id="tab-header">
							        	<p>Hyper Text Transfer Protocol (HTTP) header show data header response from <%=domain.getDomain() %>.</p>
										<div class="row-fluid f-info">
											<div class="span12">
												<h4>HTML Analysis</h4>
												<%
				                               	Map<String, String> headers = new Gson().fromJson(domain.getHeaders(), Map.class);
				                               	if (headers.size() > 0) {
				                               	%>
				                                   <ul>
				                                   		<%
				                                   			int count = 0;
				                                   			for (Map.Entry<String, String> entry : headers.entrySet()) { 
				                                   		%>
				                                   		<li>
				                                   			<span><%=entry.getKey() %>:</span>
				                                   		   	<%=entry.getValue() %>
				                                   		</li>
				                                   		<% 
				                                   				count ++;
				                                   			} 
				                                   		%>
				                                   </ul>
				                                <% } %>
											</div>
										</div>
							    	</div>
							    	
							    	<div class="tab-pane" id="tab-whois">
							    		<% if (!domain.getWhois().isEmpty()) { %>
							    		<%=domain.getWhois() %>
							    		<% } else { %>
							    		No data whois for <%=domain.getDomain() %>
							    		<% } %>
							    	</div>
							  	</div>
							</div>
						</div>
					</div>
				</section>
				<div class="homeshadowsep"></div>
				<!-- Technical Analytic END -->
				
				
				<!-- Ip Address Analytic BEGIN -->
				<% if (!domain.getIpAddress().isEmpty() && ipAddress != null) { %>
				<section class="ipAddress">
					<div class="block">
						<h3 class="title">Ip <%=domain.getIpAddress() %> Analytics</h3>
						<div class="content-block">
							<div class="tabbable"> <!-- Only required for left/right tabs -->
							  	<ul class="nav nav-tabs">
							      	<li class="active"><a href="#tab-ip-location" data-toggle="tab">Ip Location</a></li>
							      	<li><a href="#tab-whois-ip" data-toggle="tab">Whois Ip</a></li>
							  	</ul>
							  	<div class="tab-content">
							    	<div class="tab-pane active" id="tab-ip-location">
							    		<div class="row-fluid">
											<div class="span6 ip-result">
												<dl class="dl-horizontal clearfix">
													<dt>Country Code:</dt>
													<dd><%=ipAddress.getCountryCode() %></dd>
													<dt>Country Code3:</dt>
													<dd><%=ipAddress.getCountryCode3() %></dd>
													<dt>Country Name:</dt>
													<dd>
														<%=ipAddress.getCountryName() %>
													</dd>
													<dt>City:</dt>
													<dd><%=ipAddress.getCity() %></dd>
													<dt>Continent Code:</dt>
													<dd><%=ipAddress.getContinentCode() %></dd>
													<dt>Latitude:</dt>
													<dd><%=ipAddress.getLatitude() %></dd>
													<dt>Longitude:</dt>
													<dd><%=ipAddress.getLongitude() %></dd>
												</dl>
											</div>
											<div class="span6">
												<img src="http://maps.google.com/maps/api/staticmap?sensor=false&size=300x200&markers=size:mid|color:blue|label:1|<%=ipAddress.getLatitude() %>,<%=ipAddress.getLongitude() %>&markers=color:black|label:0|<%=ipAddress.getLatitude() %>,<%=ipAddress.getLongitude() %>">
											</div>
										</div>
							    	</div>
							    	
							    	<div class="tab-pane" id="tab-whois-ip">
							    		<div class="row-fluid f-info">
											<div class="span12">
												<ul>
													<li>
														<% if (!ipAddress.getWhoisIp().isEmpty()) { %>
														<%=ipAddress.getWhoisIp() %>
														<% } else { %>
														No whois ip data for <%=ipAddress.getIp() %>
														<% } %>
													</li>
												</ul>
											</div>
										</div>
							    	</div>
							    </div>
							 </div>
						</div>
					</div>
				</section>
				<div class="homeshadowsep"></div>
				<% } %>
				<!-- Ip Address Analytic END-->
				
				
				<!-- Link Analytics BEGIN -->
				<section class="siteInfo">
					<div class="block">
						<h3 class="title">In Page Analysis</h3>
						<div class="content-block">
							
							<div class="tabbable"> <!-- Only required for left/right tabs -->
							  	<ul class="nav nav-tabs">
							      	<li class="active"><a href="#tab-outbound-link" data-toggle="tab">Outbound Links</a></li>
							      	<% if (!domain.getGoogleAdsenseId().isEmpty()) { %>
							      	<li><a href="#tab-adsense-link" data-toggle="tab">Adsenses Link</a></li>
							      	<% } %>
							      	<% if (!domain.getGoogleAnalyticId().isEmpty()) { %>
							      	<li><a href="#tab-analytic-link" data-toggle="tab">Analytics Link</a></li>
							      	<% } %>
							  	</ul>
							  	<div class="tab-content">
							    	<div class="tab-pane active" id="tab-outbound-link">
							        	<p><%=domain.getDomain() %> has <%=domain.getOutlink().size() %> outlinks. The relation of external links to inner links influences the distribution of the site's weight in general. To grow the amount of indexed pages, there should be more inner links than external links.</p>
										<div class="row-fluid f-info">
											<div class="span12">
												<h4>Outbound Links</h4>
												<ul>
				                               		<li>
				                               			<%
				                               			String o = "";
				                               			List<String> outlinks = domain.getOutlink();
				                               			for (int i = 0; i < outlinks.size(); i++) { 
				                               				if (i >= 20) break;
				                               				o = UrlHelper.fomatDomains(outlinks.get(i));
				                               			%>
				                               			<%=i > 0 ? ", " : "" %><a href="/domain/<%=o %>"><%=o %></a>
				                               			<% } %>
				                               		</li>
			                                     </ul>
											</div>
										</div>
							    	</div>
							    	<% if (!domain.getGoogleAdsenseId().isEmpty()) { %>
							    	<div class="tab-pane" id="tab-adsense-link">
							        	<div class="row-fluid f-info">
											<div class="span12">
												<h4>Google Adsense Id</h4>
												<p><%=domain.getGoogleAdsenseId() %></p>
											</div>
										</div>
										<div class="row-fluid f-info">
											<div class="span12">
												<h4>Site Same Adsense</h4>
												<a href="/adsense/<%=domain.getGoogleAdsenseId() %>" class="view-more">(View more)</a>
												<ul>
													<li>
														<%
		                                       			List<String> adsenseDomains = googleAdsense.getDomains();
		                                       			for (int i = 0; i < adsenseDomains.size(); i++) { 
		                                       				if (i >= 20) break;
		                                       			%>
		                                       			<%=i > 0 ? ", " : "" %><a href="/domain/<%=adsenseDomains.get(i) %>"><%=adsenseDomains.get(i) %></a>
		                                       			<% } %>
                                       				</li>
												</ul>
											</div>
										</div>
							    	</div>
							    	<% } %>
							    	<% if (!domain.getGoogleAnalyticId().isEmpty()) { %>
							    	<div class="tab-pane" id="tab-analytic-link">
							        	<div class="row-fluid f-info">
											<div class="span12">
												<h4>Google Adsense Id</h4>
												<p><%=domain.getGoogleAnalyticId() %></p>
											</div>
										</div>
										<div class="row-fluid f-info">
											<div class="span12">
												<h4>Site Same Analytic</h4>
												<a href="/analytic/<%=domain.getGoogleAnalyticId() %>" class="view-more">(View more)</a>
												<ul>
													<li>
														<%
	                                        			List<String> analyticDomains = googleAnalytic.getDomains();
	                                        			for (int i = 0; i < analyticDomains.size(); i++) {
	                                        				if (i >= 20) break;
	                                        			%>
	                                        			<%=i > 0 ? ", " : "" %><a href="/domain/<%=analyticDomains.get(i) %>"><%=analyticDomains.get(i) %></a>
	                                        			<% } %>
	                                        		</li>
												</ul>
											</div>
										</div>
							    	</div>
							    	<% } %>
							  	</div>
							</div>
						</div>
					</div>
				</section>
				<!-- Link Analytics END -->
				
				<!-- HTML Analytics BEGIN-->
				<section class="siteInfo">
					<div class="block">
						<h3 class="title">HTML Analysis</h3>
						<div class="content-block">
							<ul class="nav nav-tabs">
						      	<li class="active"><a href="#tab-html-analytics" data-toggle="tab">Validate Info</a></li>
						      	<% if (!domain.getStrValidError().isEmpty()) { %>
						      	<li><a href="#tab-html-error" data-toggle="tab">Html Message Error</a></li>
						      	<% } %>
						  	</ul>
						  	<div class="tab-content">
						    	<div class="tab-pane active" id="tab-html-analytics">
						    		<div class="row-fluid f-info">
										<div class="span6">
											<h4>HTML validation</h4>
											<ul>
			                               		<li><%=domain.getValidError() %> Errors</li>
                                                <li><%=domain.getValidWarnings() %> Warnings</li>
			                               	</ul>
			                               	
			                               	<h4>Ratio Text/Html</h4>
											<ul>
			                               		<li><%=domain.getRatioTextHtml() %></li>
			                               	</ul>
										</div>
										<div class="span6">
											<script type="text/javascript">
										      google.load("visualization", "1", {packages:["corechart"]});
										      google.setOnLoadCallback(drawChart);
										      function drawChart() {
										        var data = google.visualization.arrayToDataTable([
										          ['', 'Warning', 'Error'],
										          ['',  <%=domain.getValidWarnings() %>,      <%=domain.getValidError()%>],
										        ]);
										
										        var options = {
										          title: 'HTML Validate',
										          hAxis: {title: '', titleTextStyle: {color: 'red'}}
										        };
										
										        var chart = new google.visualization.ColumnChart(document.getElementById('chart_valid_div'));
										        chart.draw(data, options);
										      }
										    </script>
										    <div id="chart_valid_div" style="width: 310px; height: 200px;"></div>
										</div>
									</div>
						    	</div>
						    	<% if (!domain.getStrValidError().isEmpty()) { %>
						    	<div class="tab-pane" id="tab-html-error">
						    		<div class="row-fluid f-info">
						    			<div class="span12">
						    				<h4>Message Error</h4>
						    				<ul>
						    					<%=domain.getStrValidError().replace("src=\"images", "src=\"/images") %>
						    				</ul>
						    			</div>
						    		</div>
						    	</div>
						    	<% } %>
						    </div>
						</div>
					</div>
				</section>
				<!-- HTML Analytics END -->
				

				<!-- Keyword Ranking Analysis BEGIN -->
				<% if (keyword != null && !keyword.getPositionContent().isEmpty()) { %>
				<section class="siteInfo">
					<div class="block">
						<h3 class="title">Keyword Ranking Analysis</h3>
						<div class="content-block">
							<div class="tabbable"> <!-- Only required for left/right tabs -->
							  	<ul class="nav nav-tabs">
							      	<li class="active"><a href="#tab-keyword-ranking" data-toggle="tab">Keyword Ranking</a></li>
							      	<li><a href="#tab-best-positions" data-toggle="tab">Best Positions</a></li>
							  	</ul>
							  	<div class="tab-content">
							    	<div class="tab-pane active" id="tab-keyword-ranking">
							    		<script type="text/javascript" src="http://www.google.com/jsapi"></script>
										<script type="text/javascript">
										<%=keyword.getChartJs() %>
										</script>
										
										<div class="row-fluid f-info">
											<div class="span12">
												<h4><%=keyword.getDomain() %> Ranking Position Analysis</h4>
												<ul>
													<li>
														<div id="chart_div_pie"></div>
													</li>
													<li>
														<br />
														<%=keyword.getPositionContent() %>
													</li>
												</ul>
												
												<h4><%=keyword.getDomain() %> keywords by time</h4>
												<ul>
													<li>
														<div id="chart_div_line"></div>
													</li>
												</ul>
											</div>
										</div>
							    	</div>
							    	<div class="tab-pane" id="tab-best-positions">
							    		<div class="row-fluid f-info">
											<div class="span12">
												<h4>Best of 1 positions for <%=keyword.getDomain() %></h4>
												<ul>
													<li>
														<%=keyword.getBest1position() %>
													</li>
												</ul>
												
												<h4>Best of 2-5 positions for <%=keyword.getDomain() %></h4>
												<ul>
													<li>
														<%=keyword.getBest2positions() %>
													</li>
												</ul>
												
												<h4>Best of 6-10 positions for <%=keyword.getDomain() %></h4>
												<ul>
													<li>
														<%=keyword.getBest10positions() %>
													</li>
												</ul>
											</div>
										</div>
							    	</div>
							    </div>
							</div>
						</div>
					</div>
				</section>
				<% } %>
				<!-- Keyword Ranking Analysis END -->
				
				<% if (!domain.getCountryVisitor().isEmpty()) { %>
				<!-- Visitor Analytic BEGIN-->
				<section class="dnsRecord">
					<div class="block">
						<h3 class="title">Visitor Analysis</h3>
						<div class="content-block">
							<div class="row-fluid f-info">
								<div class="span12">
									<h4>Daily Visitor</h4>
									<ul>
                                        <li><%=NumberHelper.numberFormat(domain.getDailyVisitor()) %> visits</li>                                                
                                    </ul>
								</div>
							</div>
							<%
                           	Map<String, String> visitors = new Gson().fromJson(domain.getCountryVisitor(), Map.class);
                            if (visitors != null && visitors.size() > 0) {
							%>
							<div class="row-fluid f-info">
								<div class="span12">
									<h4>Daily Visitor</h4>
									<ul>
                                        <li>
                                        	<script type='text/javascript'>
										     google.load('visualization', '1', {'packages': ['geochart']});
										     google.setOnLoadCallback(drawRegionsMap);
										
										      function drawRegionsMap() {
										        var data = google.visualization.arrayToDataTable([
										          ['Country', 'Percent (%)'],
										          <%
										          for (Map.Entry<String, String> entry : visitors.entrySet()) { 
											      %>
											      ['<%=entry.getKey() %>', <%=entry.getValue() %>],
											      <%	}
												    %>
										        ]);
										
										        var options = {numberFormat:'.#'};
										
										        var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));
										        chart.draw(data, options);
										    };
										    </script>
                                        </li>                                                
                                    </ul>
                                    <div id="chart_div" style="height: 500px;"></div>
								</div>
							</div>
							<% } %>
						</div>
					</div>
				</section>
				<div class="homeshadowsep"></div>
				<!-- Visitor Analytic END -->
				<% } %>
				
			</div>
			<!-- Left Content END -->
			
			<jsp:include page="/elements/right.jsp" />
		</div>
		
		
	</div>
		
<jsp:include page="/layouts/footer.jsp" />